<section class="title">
	<h4><?php echo lang('escort_news_cat_list_title'); ?></h4>
</section>

<section class="item">
	
	<?php if ($messages): ?>

		<?php echo form_open('admin/message/message/index/'.$thread->id); ?>

		<table border="0" class="table-list">
			<tr>
				<td style="vertical-align: top !important">
					<label><?php echo lang('escort_thread_sender_label')?></label>: <label><?php echo $thread->owner?></label><br/><br/>
					<label><?php echo lang('escort_thread_date_label')?></label>: <label><?php echo format_date($thread->created_time); ?></label><br/><br/>
					<label><?php echo lang('escort_thread_origin_label')?></label>: <label><?php echo $thread->origin?></label><br/><br/>
					<!-- <label><?php echo lang('escort_thread_escale_to_label')?></label>: <label><?php echo $thread->solver_permission_slug?></label><br/><br/> -->
				</td>
				<td>
					<table border="0" class="table-list">
						<tfoot>
							<tr>
								<td colspan="2">
									<div class="inner"><?php $this->load->view('admin/partials/pagination'); ?></div>
								</td>
							</tr>
						</tfoot>
						<tbody>
							<tr>
								<td colspan="2">
									<?php echo form_textarea(array('id' => 'message', 'name' => 'message', 'value' => $post->message, 'rows' => 3)); ?>
									<?php echo form_submit('reply', 'Reply') ?>
								</td>
							</tr>
						
								<?php foreach ($messages as $message): ?>
							<tr>	
								<td><?php echo lang('escort_thread_escale_send_by')?>: <strong><?php echo $message->sender; ?></strong></td>
								<td width="200"><?php echo format_date($message->sent_time); ?></td>
							</tr>
							<tr <?php echo $message->read?'':'class="message-unread"' ?> id="message_<?php echo $message->id?>">
								<td><?php echo $message->message; ?></td>
								<td class="align-center buttons buttons-small">
								<?php
									if($message->read){
								?>
									<?php echo anchor('#', lang('escort_thread_mark_as_unread_label'), 'class="button edit mark-message" id="'.$message->id.'"'); ?>
								<?php
									}else{
								?>
									<?php echo anchor('#', lang('escort_thread_mark_as_read_label'), 'class="button edit mark-message" id="'.$message->id.'"'); ?>
								<?php
									}
								?>
									<?php echo anchor('admin/message/message/delete/'.$thread->id.'/' . $message->id, lang('global:delete'), 'class="confirm button delete"') ;?>
								</td>
							</tr>
							<tr>
								<td colspan="2">
								<hr/>
								</td>
							</tr>
							<?php endforeach; ?>
						</tbody>
					</table>
				</td>
			</tr>
		</table>
		<?php echo form_close(); ?>

	<?php else: ?>
		<div class="no_data"><?php echo lang('escort_news_cat_no_categories'); ?></div>
	<?php endif; ?>
</section>